package com.ganmiao.web.supplier.controller.sys;


import com.ganmiao.annotation.NoAuthorization;
import com.ganmiao.resp.CommonResultRes;
import com.ganmiao.server.sys.dto.DistrictInfoDto;
import com.ganmiao.server.sys.service.DistrictInfoService;
import com.ganmiao.server.sys.vo.DistrictInfoVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Api(tags = "省市区")
@Slf4j
@RestController
@RequestMapping("/districtInfo")
public class DistrictInfoController {

    @Autowired
    private DistrictInfoService districtInfoService;

//    @ApiOperation(value = "导入省市区")
//    @PostMapping("/insertDistrictInfo")
//    public CommonResultRes insertDistrictInfo(@RequestBody List<DistrictInfoDto> dtoList){
//        districtInfoService.insertDistrictInfo(dtoList);
//        return new CommonResultRes();
//    }

    @ApiOperation(value = "查询省市区")
    @GetMapping("/getDistrictInfo")
    @NoAuthorization
    public CommonResultRes<List<DistrictInfoVo>> getDistrictInfo(){
        return new CommonResultRes<>(districtInfoService.getDistrictInfo());
    }

    @ApiOperation(value = "查询省市")
    @GetMapping("/getSecondDistrictInfo")
    @NoAuthorization
    public CommonResultRes<List<DistrictInfoVo>> getSecondDistrictInfo(){
        return new CommonResultRes<>(districtInfoService.getSecondDistrictInfo());
    }
}
